#include "CandidateFactory.h"
#include "Candidate.h"
#include "RandomNumberGenerator.h"
#include "QDebug"

CandidateFactory::CandidateFactory()
{
}
CandidateFactory::~CandidateFactory() {
}

std::vector<Candidate*> CandidateFactory::generateInitialPopulation(int populationSize, int genomeSize) {
    std::vector<Candidate*> candidates;
    for(int i=0; i<populationSize; i++) {
        candidates.push_back(new Candidate(genomeSize,0));
        for(int i2=0; i2<genomeSize; i2++) {
            float val = (float)RandomNumberGenerator::nextFloat(2);
            candidates.at(i)->addChromosome(val);
        }
    }
    return candidates;
}
void CandidateFactory::resetPopulation(std::vector<Candidate*> population,int genomeSize) {
    for(int i=0; i<population.size(); i++) {
        for(int i2=0; i2<genomeSize; i2++) {
            float val = (float)RandomNumberGenerator::nextFloat(2);
            population.at(i)->setChromosome(i2,val);
        }
    }
}

std::vector<Candidate*> CandidateFactory::generateInitialPopulation(int populationSize,int genomeSize,std::vector<Candidate*> seedCandidates) {

}
std::vector<Candidate*> CandidateFactory::generateVariation(int populationSize, int genomeSize, Candidate *seedCandidate) {

}
